package com.snail.billing.session;

import com.snail.billing.DataCache;
import com.snail.billing.net.BillingArrayHttpSession;
import com.snail.billing.net.BillingEncode;
import com.snail.billing.net.BillingSecurity;

public class OneKeyRegisterSession extends BillingArrayHttpSession {

	public OneKeyRegisterSession(String userName, String pwd, String fromValue) {
		DataCache cache = DataCache.getInstance();
		String host = cache.importParams.hostBusiness;
		String address = String.format("http://%s/passport/oneKeyToRegister.do", host);
		setAddress(address);
		addBillingPair("userName", BillingEncode.enCode(userName, "GBK"));
		addBillingPair("pwd", pwd);
		addBillingPair("gid", cache.importParams.gameId);
		addBillingPair("pid", "7");
		addBillingPair("fromValue", fromValue);
		buildParamPair();
		addParamPair("extendValue", "AN");
	}

	@Override
	public BillingSecurity getSecurity() {
		if (DataCache.getInstance().isSandbox) {
			return BillingSecurity.securitySandbox2;
		}
		return BillingSecurity.security;
	}

}
